package com.lqk.shardingjdbcproj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lqk.shardingjdbcproj.entity.Course;
import com.lqk.shardingjdbcproj.mapper.CourseMapper;
import com.lqk.shardingjdbcproj.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;


    @Override
    public int insertCourse(Course course) {
        int insert = courseMapper.insert(course);
        return insert;
    }

    @Override
    public Course selectOne(long id) {
        QueryWrapper<Course> wrapper = new QueryWrapper<>();
        wrapper.eq("cid",id);
        return courseMapper.selectOne(wrapper);
    }


}
